package com.iterator.iterator;

import java.util.Iterator;
import java.util.List;

//输出学院和系
public class OutputImpl {

    List<College> colleges ;

    public OutputImpl(List<College> colleges){
        this.colleges = colleges;
    }

    //遍历所有学院，使用学院的迭代器，输出学院中的系
    public void printCollege(){
        for (College college : colleges) {
            System.out.println("======="+college.getName()+"=======");
            Iterator iterator = college.getIterator();
            while (iterator.hasNext()){
                Department next = (Department)iterator.next();
                System.out.println(next.getName()+"--"+next.getDesc());
            }
        }
    }
}
